-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-86139: Correct NamedTuple and TypedDict's type in typing.rst #143692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could additionally clarify the implications of this?
E.g. "NamedTuple is now a function that can be used as a class base. It is no longer a class, so it cannot be used with isinstance(), issubclass() and other routines that are expected to work for class objects" .
Similar for TypedDict.
(Prior to these changes isinstance() et al. would work).
I figured this while wondering if we could briefly say why these constructs are no longer classes, and that's what the explanations from GH-84366 and GH-84368 tell me would be the most fitting here.
|
@johnslavik, I'm not sure I agree -- I don't think we should devote too much space in the typing docs for this. As @JelleZijlstra said on the issue, exactly what kind of objects these symbols are at runtime is an implementation detail that most users shouldn't worry about. Giving too much space in the docs for these details would give the incorrect impression that these are things that users need to understand, when they're almost always not. |
|
Thanks @aisk for the PR, and @AlexWaygood for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…pythonGH-143692) (cherry picked from commit e22b68568a30e65358f6036e4d0e5505d0f76fcb) Co-authored-by: AN Long <aisk@users.noreply.github.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
…pythonGH-143692) (cherry picked from commit e22b685) Co-authored-by: AN Long <aisk@users.noreply.github.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
GH-143696 is a backport of this pull request to the 3.14 branch. |
|
GH-143697 is a backport of this pull request to the 3.13 branch. |
|
Thanks @aisk! |
|
This broke references to the
And so breaks Sphinx cross references. |
Ah, because functions cannot have attributes, according to Sphinx? That's too bad. Great catch @Viicos. @aisk, would you be able to make a PR reverting just the change from |
Yeah that might be it. I'm wondering if it would make sense to document them as |
Partially reverts pythonGH-143692; see python#143692 (comment)
Oops, I've read this right after making that PR #143702 |
That works for me if Sphinx renders it okay! |
|
Yeah |
|
@AlexWaygood Sorry for breaking this. I went to sleep after submitting this, so I only just saw the notification. @johnslavik Thanks for fixing it! |

📚 Documentation preview 📚: https://cpython-previews--143692.org.readthedocs.build/